package com.web;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * Created with IntelliJ IDEA.
 * User: wangchen
 * Date: 16-4-24
 * Time: 下午5:48
 * To change this template use File | Settings | File Templates.
 */
public class WebServer {
    public void serverStart(int port){
        try {
            ServerSocket serverSocket = new ServerSocket(port);
            while (true){
                Socket socket = serverSocket.accept();
                new Processor(socket).start();
            }

        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

    }

    public static void main(String []args){
          // if(args.length>=1){
//               String port = args[0];
               String port = "8082";
                 int p = Integer.parseInt(port);
               new WebServer().serverStart(p);
         //  }
    }
}
